import request from '../../http'

const URL = {
	LOGIN: '/wx_login',
	LOGOUT: '/wx_logout',
	VIEW_AVAILABLE_VENUES: '/appointments/sites/listApp',
	VIEW_AVAILABLE_DEFINITION: '/processDefinitions/listProcess',
	VIEW_AVAILABLE_VENUES_DETAILS: '/appointments/sites/listOpt',
	BOOK_GET_TYPE: '/appointments/dict/getType',
	NEW_APPOINTMENT: '/appointments/processes'
}
// 登录
export const userLogin = ({
	code,
	state
}) => request(URL.LOGIN, 'POST', {
	code,
	state
})

// 登出
export const userLogout = () => request(URL.LOGOUT, 'POST')

//查看可预约场馆 
export const viewAvailableVenues = ({
	type,
	siteType,
	startTime,
	endTime,
	pageNum,
	pageSize
}) => request(URL.VIEW_AVAILABLE_VENUES, 'GET', {
	type,
	siteType,
	startTime,
	endTime,
	pageNum,
	pageSize
})

// 查看所有流程定义
export const viewAvailableDefinition = () => request(URL.VIEW_AVAILABLE_DEFINITION, 'GET')

// 查看用户已经预约信息
export const viewAvailableVenuesDetails = ({
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	pageNum,
	pageSize
}) => request(URL.VIEW_AVAILABLE_VENUES_DETAILS, 'GET', {
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	pageNum,
	pageSize
})

// 新增预约
export const newAppoinment = ({
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	appRemark,
	siteId
}) => request(URL.NEW_APPOINTMENT, 'POST', {
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	appRemark,
	siteId
})

// 


// 字典查询类型
export const getType = ({
	dictType
}) => request(URL.BOOK_GET_TYPE, 'GET', {
	dictType
})
